package com.atguigu.educms.controller;

import com.atguigu.commonutils.R;
import com.atguigu.educms.entity.CrmBanner;
import com.atguigu.educms.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 前台页面显示controller
 */
@RestController
@RequestMapping("/educms/bannerFront")
public class UserCrmBannerController {
    @Autowired
    private CrmBannerService crmBannerService;

    /**
     * 获取所有的banner
     */
    @Cacheable(key = "'selectIndexList'",value="banner")
    @GetMapping("/getAllBanner")
    public R getAllBanner() {
        List<CrmBanner> list = crmBannerService.list(null);
        return R.ok().data("banners", list);
    }
}
